package mobi.greenplate.theweb.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import mobi.greenplate.theweb.domain.Transport;


@XmlRootElement(name="transport-list")
public class TransportListConverter {

    private final List<Transport> entities;

    public TransportListConverter() {
        this.entities=new ArrayList<Transport>();
    }
    
    public TransportListConverter(List<Transport> entities) {
        this.entities = entities;
    }

    @XmlElement
    public List<TransportConverter> getTransport(){
        final List<TransportConverter> list = new ArrayList<TransportConverter>();
        for (Transport transport : entities) {
            list.add(new TransportConverter(transport));
        }
        return list;
    }

    @XmlTransient
    public List<Transport> getEntities(){
        return Collections.unmodifiableList(this.entities);
    }

}


